﻿using HuiLian.Common.Configs;
using HuiLian.Common.Helpers;
using HuiLian.Common.Output;
using HuiLian.Service.Platform.Document;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using System.Threading.Tasks;
using System;
using HuiLian.Service.Platform.PipeSurvivalTime;
using HuiLian.Common.Input;
using HuiLian.Model.Platform;

namespace HuiLian.Web.Controllers.Platform
{
    /// <summary>
    /// 模型结果
    /// </summary>
    public class PipeSurvivalTimeController : AreaController
    {
        private readonly IPipeSurvivalTimeService _pipeSurvivalTimeServices;
        private readonly UploadConfig _uploadConfig;
        private readonly UploadHelper _uploadHelper;

        public PipeSurvivalTimeController(
            IPipeSurvivalTimeService pipeSurvivalTimeServices,
            IOptionsMonitor<UploadConfig> uploadConfig,
            UploadHelper uploadHelper
        )
        {
            _pipeSurvivalTimeServices = pipeSurvivalTimeServices;
            _uploadConfig = uploadConfig.CurrentValue;
            _uploadHelper = uploadHelper;
        }

        /// <summary>
        /// 查询某个管线的模型结果
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IResponseOutput> Get(long id)
        {
            return await _pipeSurvivalTimeServices.GetAsync(id);
        }

        /// <summary>
        /// 查询分页模型结果
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> Page(PageInput<PipeEntity> input)
        {
            return await _pipeSurvivalTimeServices.PageAsync(input);
        }

        /// <summary>
        /// 查询分页模型结果
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> UpdateTime(PageInput<PipeEntity> input)
        {
            return await _pipeSurvivalTimeServices.UpdateTime(input);
        }

    }
}
